package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @PROJECT_NAME: cloud2020
 * @DESCRIPTION: nacos
 * @Author: csc
 * @DATE: 2023/3/29 15:22
 */
@RestController
@Slf4j
public class OrderNacosController {

    @Resource
    private RestTemplate restTemplate;

     @Value("${service-url.nacos-user-service}")
     private String serverURL;


    @GetMapping(value = "/consumer/payment/nacos/{id}")
    public ResponseEntity<String> getPayment(@PathVariable("id") Integer id){
        return restTemplate.getForEntity(serverURL+"/payment/nacos/"+id,String.class);
    }//end getPayment

}
